plot.bal.qq <- function(out, color = TRUE){
  qqplot(out[["bal.comp"]], out[["bal.bl"]], xlim=c(0,1), ylim=c(0,1), xlab = bquote(Unblocked ~ italic(d)^2 ~ "p-values"), ylab = bquote(Blocked ~ italic(d)^2 ~ "p-values"))
  par(new=TRUE)
  qqplot(out[["bal.clas"]], out[["bal.bl"]], xlim=c(0,1), ylim=c(0,1), xlab = "", ylab = "", axes = FALSE, pch=19)
  cols <- c("red", "blue")
  ltys <- c(1, 2)
  if(color == FALSE){
    cols <- c("black", "black")
    ltys <- c(2, 3)
  }
  abline(0,1, col=cols[1], lty=ltys[1])
  abline(out[["bal.actual"]], 0, col = cols[2], lty = ltys[2])
}

plot.te <- function(out, x.lims = NULL, y.lims = NULL){
  if(is.null(y.lims)){
    y.lims <- c(0, 1.3*max(density(c(out[["te.comp"]], out[["te.clas"]], out[["te.bl"]]))$y))
  }
  if(is.null(x.lims)){
    x.lims <- c(1.3*min(c(out[["te.comp"]], out[["te.clas"]], out[["te.bl"]])), 1.3*max(c(out[["te.comp"]], out[["te.clas"]], out[["te.bl"]])))
  }
  plot(density(out[["te.comp"]]), xlim = x.lims, ylim = y.lims, xlab ="Treatment Effect Estimates", main="")
  par(new=TRUE)
  plot(density(out[["te.clas"]]), xlim = x.lims, ylim = y.lims, lty = 2, axes = F, xlab = "", ylab = "", main="")
  par(new= TRUE)
  plot(density(out[["te.bl"]]), xlim = x.lims, ylim = y.lims, lwd = 3, axes = F, xlab = "", ylab = "", main="")
}